<?php

define('FRIEND_NOTIFICATION_PARENT', 'object');
define('FRIEND_NOTIFICATION_SUBTYPE', 'friend_notification');
define('FRIEND_NOTIFICATION_CLASS', 'FriendNotification');

define('FRIEND_NOTIFICATION_TYPE_REQUEST', 'friend_request');
define('FRIEND_NOTIFICATION_TYPE_RESPONSE', 'friend_response');
define('FRIEND_NOTIFICATION_TYPE_CANCEL', 'friend_cancel');
define('FRIEND_NOTIFICATION_TYPE_INTEREST_RATING', 'friend_rating');
define('FRIEND_NOTIFICATION_TYPE_REPORT', 'friend_report');
define('FRIEND_NOTIFICATION_TYPE_COMMENT', 'friend_comment');
define('FRIEND_NOTIFICATION_TYPE_FOLLOWING', 'friend_following');
define('FRIEND_NOTIFICATION_TYPE_FAVORITE', 'friend_favorite');

register_entity_type(FRIEND_NOTIFICATION_PARENT, FRIEND_NOTIFICATION_SUBTYPE);
// This operation only affects the db on the first call for this subtype
// If you change the class name, you'll have to hand-edit the db
add_subtype(FRIEND_NOTIFICATION_PARENT, FRIEND_NOTIFICATION_SUBTYPE, FRIEND_NOTIFICATION_CLASS);

class FriendNotification extends AbstractNotification {

    protected function initialise_attributes() {
        parent::initialise_attributes ();
        $this->attributes ['subtype'] = FRIEND_NOTIFICATION_SUBTYPE;
        $this->access_id = ACCESS_PUBLIC;
    }

    public function __construct($guid = null) {
        parent::__construct($guid);
    }

    // more customization
    public function toArray() {
        $result = parent::toArray();
        $result['type'] = $this->getMetaData(ABSTRACT_NOTIFICATION_TYPE);
        return $result;
    }

}

?>